﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XrmLibrary.MsCrm4Adapter.Extensions
{
    public static class QueryExtensions
    {
        public static Microsoft.Crm.Sdk.Query.QueryBase ToCrm4QueryExpression(this Microsoft.Xrm.Sdk.Query.QueryBase crm2011Query)
        {

            Microsoft.Xrm.Sdk.Query.QueryExpression crm2011QueryExpression = (Microsoft.Xrm.Sdk.Query.QueryExpression) crm2011Query;
            Microsoft.Crm.Sdk.Query.QueryBase crm4QueryExpression = new Microsoft.Crm.Sdk.Query.QueryExpression(crm2011QueryExpression.EntityName)
                                                                        {
                                                                            ColumnSet = crm2011QueryExpression.ColumnSet.ToColumnSet4()
                                                                        };
            return crm4QueryExpression;
        }
    }
}
